package com.carbon.system.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.carbon.domain.common.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.List;

/**
 * 菜单权限表
 * 
 * @author carbon
 * @date 2024-01-01
 */
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "SysMenu对象", description = "菜单 ")
@TableName("sys_menu")
public class SysMenu extends BaseEntity {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "菜单id")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @NotNull(message = "父级菜单ID不能为空")
    @ApiModelProperty(value = "父级权限")
    @TableField("parent_id")
    private Long parentId;

    @NotBlank(message = "菜单名称不能为空")
    @ApiModelProperty(value = "权限菜单名称")
    @TableField("menu_name")
    private String menuName;

    @NotNull(message = "菜单级别不能为空")
    @ApiModelProperty(value = "权限菜单级别")
    @TableField("menu_level")
    private Integer menuLevel;

    @ApiModelProperty(value = "图标")
    @TableField("menu_icon")
    private String menuIcon;

    @ApiModelProperty(value = "排序")
    @TableField("order_num")
    private Float orderNum;

    @NotBlank(message = "菜单url不能为空")
    @ApiModelProperty(value = "菜单URL")
    @TableField("menu_url")
    private String menuUrl;

    @NotNull(message = "菜单状态不能为空")
    @ApiModelProperty(value = "状态 0启用，1禁用")
    @TableField("status")
    private Integer status = 0; // 默认启用状态

    @ApiModelProperty(value = "备注")
    private String remarks;

    @ApiModelProperty(value = "是否隐藏")
    @TableField("hidden")
    private Boolean hidden;

    /** 子菜单 */
    @TableField(exist = false)
    private List<SysMenu> children;
}